<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript标签</title>
</head>

<!-- continue 语句（带有或不带标签引用）只能用在循环中。
break 语句（不带标签引用），只能用在循环或 switch 中。
通过标签引用，break 语句可用于跳出任何 JavaScript 代码块 -->

<body>
    <script>
        cars = ["BMW", "Volvo", "Saab", "Ford"];
        list: {
            document.write(cars[0] + "<br />");
            document.write(cars[1] + "<br />");
            document.write(cars[2] + "<br />");
            break list;
            document.write(cars[3] + "<br />");
            document.write(cars[4] + "<br />");
            document.write(cars[5] + "<br />");
        }
    </script>
</body>

</html>